exports.login = (req,res)=> { 

    let user = global.dbHelper.getModel('user');  
    if(req.method == 'POST'){
	    let username = req.body.username,
	        password = req.body.password;  
	    console.log(username,password)
	    user.findOne({username: username},(error,doc)=>{
	    	if(error){
	    		console.log(error)
	    	}else if(!doc){
	            res.json({
	                "code": 200,
	                "msg": "用户不存在"
	            });
	        }else if(password != doc.password){
            	res.json({
            		"code":200,
            		"msg":"密码不正确"
            	})
	        }else{
	        	res.json({
            		"code":200,
            		"msg":"登录成功"
            	})
	        }
	        
	    }) 
    }  
  }
